package com.coming.mySpring.utils;

import lombok.Data;

@Data
public class AjaxResult {
    //返回信息
    private String msg;
    //状态------成功 或者 失败
    private Boolean success;
    //数据
    private Object date;
    //总条数
    private Long total;

    public AjaxResult() {
    }

    public AjaxResult(String msg, Boolean success) {
        this.msg = msg;
        this.success = success;
    }

    public static AjaxResult success() {
        return new AjaxResult("成功",true);
    }
    public static AjaxResult error() {
        return new AjaxResult("失败",false);
    }


    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setDate(Object date) {
        this.date = date;
        return this;
    }

    public AjaxResult setTotal(Long total) {
        this.total = total;
        return this;
    }
}
